#!/usr/bin/python
from urllib import urlopen
from BeautifulSoup import BeautifulSoup

def GetApacheVersion():
    # get apache webserver latest version
    site='http://httpd.apache.org/download.cgi'
    try:
        html=urlopen(site).read()
        soup=BeautifulSoup(html)
        dest=soup.find('p',text="Stable Release - Latest Version:").findNext("ul")
        return dest.li.a.string
    except:
        return None

def GetIISVersion():
    """ find a website to get the latest version
        code here
    """
    return "Microsoft-IIS/8.5" 

def GetNginxVersion():
    # get nginx webserver latest version
    site="http://nginx.org/en/download.html"
    try:
        html=urlopen(site).read()
        soup=BeautifulSoup(html)
        dest=soup.find(text="Stable version").findNext("td")
        return dest.findNext("td").find("a").string
    except:
        return None
    
